<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);

if(isset($_POST["kaarttoe"]))
{
	$genre = $_POST["genre"];
	$nrpl = $_POST["nrpl"];
	$code = $_POST["code"];
	$sql = "insert into shellkaarten (`genre`, `nrpl`, `code`) VALUES ('$genre', '$nrpl', '$code')";
	$res = mysql_query($sql, $mysql_id);
	Header( "Location: shll.php" );
}

if(isset($_POST["toevoegen"])) 
{
	?>
	<form action="shll.php" method="post">
	<table border="1" align="center">
	<tr><td colspan="2" class="delsaux"><div style="text-align: center">Ajouter une carte</div></td></tr>
	<tr><td class="delsaux2">Plaque du vehciule</td><td><input type="text" name="nrpl" value=""></td></tr>
	<tr><td class="delsaux2">Code de la carte</td><td><input type="text" name="code" value=""></td></tr>
	<tr><td class="delsaux2">Genre de carte</td><td><input type="text" name="genre" value=""></td></tr>
	<tr><td colspan="2" class="delsaux"><div style="text-align: center"><input type="submit" name="kaarttoe" value="Ajouter la carte"></div></td></tr>
	</table>
	
	
	</form>
	
	<?php
	exit();
}

?>
<br /><br /><br />
<table border="1" align="center" width="25%">
<tr><td colspan="5" class="delsaux">Cartes Gasoil</td></tr>
<tr>
<td class="delsaux2">Nummerplaat</td><td class="delsaux2">Code</td><td class="delsaux2">Genre</td><td class="delsaux2">Modifier</td><td class="delsaux2">Supprimer</td>
</tr>
<?php
$sql="Select * FROM shellkaarten order by `genre`,`nrpl`";
$res = mysql_query($sql, $mysql_id);
	while ($row = mysql_fetch_row($res)) {
		 echo "<tr><td><strong>$row[0]</strong></td>
		 <td><strong><div style='text-align: center'>$row[1]</div></strong></td>
		 <td><strong><div style='text-align: center'>$row[3]</div></strong></td>
		 <td><strong><div style='text-align: center'><a href=shellwijzigen.php?id=$row[2] class = 'linkblue'>Modifier</a></div></td>
		 <td><strong><div style='text-align: center'><a href=shellverwijderen.php?id=$row[2] class = 'linkblue'>Supprimer</a></div></td></tr>";		
	}
?>
<tr><td colspan="5" class="delsaux">
<br>
<form action="shll.php" method="post">
<input type="submit" name="toevoegen" value="Ajouter une carte">
</form>
</td></tr>
</table>

<?php
include('footer.php');
?>